package com.ssy.lingxi.marketing.controller.activity;

import com.ssy.lingxi.common.constant.marketing.BelongTypeEnum;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.marketing.model.vo.activity.request.ActivityExecutePageReq;
import com.ssy.lingxi.marketing.model.vo.activity.request.PfActivityGoodsPageReq;
import com.ssy.lingxi.marketing.model.vo.activity.request.PlatformActivityPageReq;
import com.ssy.lingxi.marketing.model.vo.activity.response.ActivityExecuteDetailPageResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.ActivityExecuteGoodsPageResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.PlatformActivityDetailResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.PlatformActivityExecutePageResp;
import com.ssy.lingxi.marketing.model.vo.common.request.CommonIdReq;
import com.ssy.lingxi.marketing.service.IActivityExecuteService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu 平台后台 - 平台营销活动执行
 *
 * @author ds
 * @version 2.0.0
 * @date 2021/12/23
 */
@RestController
@RequestMapping("/marketing/platform/activity/execute")
public class PlatformActivityExecuteController extends BaseController {

    @Resource
    private IActivityExecuteService activityExecuteService;

    /**
     * 分页列表
     */
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformActivityExecutePageResp>> pagePlatform(@Valid PlatformActivityPageReq pageReq) {
        return activityExecuteService.pagePlatform(getSysUser(), pageReq);
    }

    /**
     * 活动详情
     */
    @GetMapping(value = "/detail")
    public Wrapper<PlatformActivityDetailResp> detailPlatform(CommonIdReq req) {
        return activityExecuteService.detailPlatform(getSysUser(), req);
    }

    /**
     * 活动详情 - 活动商品(分页)
     */
    @RequestMapping(value = "/detail/goods/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteGoodsPageResp>> pageByActivityGoodsPlatform(@Valid PfActivityGoodsPageReq req) {
        return activityExecuteService.pageByActivityGoodsPlatform(getSysUser(), req);
    }

    /**
     * 活动详情 - 活动商品-执行明细(分页)
     */
    @RequestMapping(value = "/detail/goods/execute/detail/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityExecuteDetailPageResp>> pagePlatformExecuteDetailOfAbility(@Valid ActivityExecutePageReq req) {
        req.setBelongType(BelongTypeEnum.PLATFORM.getCode());
        return activityExecuteService.pageMerchantExecuteDetailOfAbility(getSysUser(), req);
    }

}
